Skip to content

increase file descriptor limits#6230

Merged
ehsandeep merged 5 commits intodevfrom
fix-function-test-macos
May 18, 2025
Merged

increase file descriptor limits#6230
ehsandeep merged 5 commits intodevfrom
fix-function-test-macos

Conversation

@knakul853
Copy link
Contributor

@knakul853 knakul853 commented May 17, 2025

Proposed changes

while running function test it looks for .nuclei-ignore which doesn't exist, created this to avoid file not found error

Checklist

  • Pull request is created against the dev branch
  • All checks passed (lint, unit/integration/regression tests etc.) with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Summary by CodeRabbit

  • Chores
    • Enhanced the functional test process with additional template validation steps.
    • Automated setup of necessary directories and files before testing.
    • Improved macOS support by attempting to increase the file descriptor limit for better performance.
    • Expanded debug mode activation to support an additional environment variable for easier troubleshooting.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented May 17, 2025

"""

Walkthrough

The functional test run script now determines executable extensions from the environment, creates required config directories and files, adjusts macOS file descriptor limits during CI runs, builds multiple binaries with debug logs, installs and validates templates, and runs tests using eval. The main.go debug mode check now also activates on RUNNER_DEBUG=1.

Changes

File(s) Change Summary
cmd/functional-test/run.sh Changed OS detection to use RUNNER_OS, added macOS-specific ulimit adjustments during CI, created config dirs/files, added template install and validation steps, used eval for command execution, enhanced debug output.
cmd/functional-test/main.go Expanded debug mode activation to include RUNNER_DEBUG=1 in addition to DEBUG=true.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant run_sh as run.sh script
    participant OS
    participant nuclei_dev
    participant functional_test

    User->>run_sh: Execute run.sh
    run_sh->>OS: Determine RUNNER_OS and set executable extension
    alt macOS on CI
        run_sh->>OS: Increase file descriptor limits (sysctl, launchctl, ulimit)
    end
    run_sh->>OS: Create .nuclei-config/nuclei/ directory and .nuclei-ignore file
    run_sh->>run_sh: Build binaries (functional-test, nuclei_dev, nuclei)
    run_sh->>nuclei_dev: Install templates (-update-templates)
    run_sh->>nuclei_dev: Validate templates (-validate)
    run_sh->>run_sh: Output .nuclei-ignore contents
    run_sh->>nuclei_dev: Validate templates (-validate -debug -v)
    run_sh->>nuclei_dev: List templates (-tl)
    run_sh->>functional_test: Run functional tests with binaries and test cases
Loading

Poem

🐰 In scripts I hop, with care and grace,
Creating paths, a config place.
Limits raised for Mac to run,
Templates checked, the tests begun.
Debug flags wave, the code’s alive,
With every line, we thrive and strive!
🌿✨
"""

Note

⚡️ AI Code Reviews for VS Code, Cursor, Windsurf

CodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback.
Learn more here.


Note

⚡️ Faster reviews with caching

CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.
Enjoy the performance boost—your workflow just got faster.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro (Legacy)

📥 Commits

Reviewing files that changed from the base of the PR and between 7918a49 and f1cc3e9.

⛔ Files ignored due to path filters (1)
  • .github/workflows/tests.yaml is excluded by !**/*.yaml
📒 Files selected for processing (2)
  • cmd/functional-test/main.go (1 hunks)
  • cmd/functional-test/run.sh (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • cmd/functional-test/main.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • cmd/functional-test/run.sh
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Lint

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@ehsandeep ehsandeep linked an issue May 17, 2025 that may be closed by this pull request
@ehsandeep ehsandeep marked this pull request as ready for review May 17, 2025 18:19
@auto-assign auto-assign bot requested a review from dwisiswant0 May 17, 2025 18:19
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
cmd/functional-test/run.sh (2)

10-13: Ensure robust creation of config directory and ignore file
Consider adding error handling or enabling strict mode to fail early if directory or file creation fails. For example:

+# Enable strict mode immediately after the shebang
+set -euo pipefail

  mkdir -p .nuclei-config/nuclei/ || { echo "Error: could not create config directory"; exit 1; }
  touch .nuclei-config/nuclei/.nuclei-ignore || { echo "Error: could not create ignore file"; exit 1; }

34-37: Clarify comment for ignore file debug output
The comment “Check .nuclei-ignore file format” is misleading since it only prints the file contents. Rename it to accurately reflect its purpose:

- # Check .nuclei-ignore file format
+ # Debug: Display contents of .nuclei-ignore file
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3957237 and a7e8c74.

⛔ Files ignored due to path filters (1)
  • .github/workflows/tests.yaml is excluded by !**/*.yaml
📒 Files selected for processing (1)
  • cmd/functional-test/run.sh (2 hunks)

@knakul853 knakul853 changed the title add missing file increase file descriptor limits May 17, 2025
* uses CI runtime env vars (`RUNNER_OS` &
  `RUNNER_DEBUG`)
* restores originial `ulimit`

Signed-off-by: Dwi Siswanto <git@dw1.io>
Copy link
Member

@dwisiswant0 dwisiswant0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for catching this and helping out, really appreciate it, @knakul853!

@dwisiswant0
Copy link
Member

dwisiswant0 commented May 18, 2025

it’s been tricky for me, and i think this requires further investigation to understand why it’s failing to create the .nuclei-ignore config file on macOS. could it be due to limitations in the CI or something else entirely? AFAIK, that config file is typically generated during the -update-templates process, and this particular update seems like a bit of a hacky workaround, no?

cc: @Mzack9999

@ehsandeep ehsandeep merged commit 242b1e1 into dev May 18, 2025
20 checks passed
@ehsandeep ehsandeep deleted the fix-function-test-macos branch May 18, 2025 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Functional tests failing on OSX (CI) environment

3 participants